package com.foruo.demo.elasticjob;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import org.springframework.stereotype.Component;

@ElasticSimpleJob(cron="0/10 * * * * ?",jobName="test123",shardingTotalCount=2,jobParameter="测试参数",shardingItemParameters="0=A,1=B" , dataSource = "datasource")
@Component
public class MySimpleJob implements com.dangdang.ddframe.job.api.simple.SimpleJob {

    @Override
    public void execute(ShardingContext content) {
        String n = null;
        System.out.println(n.length());
        System.out.println("ShardingParameter:"+content.getShardingParameter() + "，Thread - " + Thread.currentThread().getName());
//        //do something
//        System.out.println("JobName:"+content.getJobName());
//        System.out.println("JobParameter:"+content.getJobParameter());
//        System.out.println("ShardingItem:"+content.getShardingItem());
//        System.out.println("ShardingParameter:"+content.getShardingParameter());
//        System.out.println("ShardingTotalCount:"+content.getShardingTotalCount());
//        System.out.println("TaskId:"+content.getTaskId());
//        System.out.println("---------------------------------------");

    }
}